package com.roubsite.admin.action;

import com.roubsite.utils.CreateImageCode;
import com.roubsite.utils.StringUtils;
import com.roubsite.web.action.RSAction;

public class VerifyCodeAction extends RSAction {

	@Override
	public void execute() throws Exception {
		int w = 200, h = 80;// 图片大小
		// 设置页面不缓存
		response.setHeader("Pragma", "No-cache");
		response.setHeader("Cache-Control", "no-cache");
		response.setDateHeader("Expires", 0);
		response.setContentType("image/jpeg");
		String code = CreateImageCode.generateVerifyCode(4);
		CreateImageCode.outputImage(w, h, response.getOutputStream(), code);
		this.getSession().setAttribute("verifyImg", code);
		this.getSession().setAttribute("verifyImgTime", StringUtils.getUnixDate());
	}

}
